package com.mano.mall.gateway.feign;

import com.alibaba.fastjson.JSONObject;
import com.mano.mall.api.auth.AuthorizationService;
import com.mano.mall.common.base.BaseApiService;
import com.mano.mall.common.base.BaseResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;

@FeignClient(value = "mano-mall-auth",fallback = AuthorizationServiceFeignCallBack.class )
public interface AuthorizationServiceFeign extends AuthorizationService {

}

@Component
class AuthorizationServiceFeignCallBack extends BaseApiService implements AuthorizationServiceFeign{
    @Override
    public BaseResponse<JSONObject> applyAppInfo(String appName) {
        return setResultError("服务器忙，请稍后重试");
    }

    @Override
    public BaseResponse<JSONObject> getAccessToken(String appId, String appSecret) {
        return setResultError("服务器忙，请稍后重试");
    }

    @Override
    public BaseResponse<JSONObject> getAppInfo(String accessToken) {
        return setResultError("服务器忙，请稍后重试");
    }
}


